package sg.edu.nus.iss.vmcs.store;
import sg.edu.nus.iss.vmcs.util.VMCSException;

/**
*
*
* 
* @author Farid
*/
public class StoreItemFactory 
{	Store stObj;

private StoreItem storeItem=null;
public static StoreItemFactory thisObj = null;


public static StoreItemFactory getInstance() {
	if (thisObj == null) {
		synchronized (StoreItemFactory.class) {
			if (thisObj == null) {
				thisObj = new StoreItemFactory();
			}
		}
	}
	return thisObj;
}


public StoreItem createStoreItem(StoreObject obj,int qty,int storeItemtype)throws VMCSException 
	{
		StoreItem store_Item=null;
		switch (storeItemtype) {
		case Store.CASH:
			store_Item = new CashStoreItem((Coin)obj,qty);//Input Coin & qty to create cashStoreItem
			break;
		
		case Store.DRINK:
			store_Item = new DrinksStoreItem((DrinksBrand)obj,qty);//Input Drink Brands & qty to create drinkStoreItem
			break;
		
		default:
			throw new VMCSException("StoreItemFactory:create:",
					"Unkonwn StoreItem Type");
		
		}
		return store_Item;		
	}
	
	
	
}
